﻿#ifndef __STYLE_H__
#define __STYLE_H__
#include <QString>

/// @brief 获得滚动区域的样式, 这里不要返回引用, 因为出作用域就会被销毁
static inline const QString get_scroll_area_style()
{
    return "QScrollBar:vertical {"
           "    width: 6px;"
           "    background: transparent;"
           "    border-radius: 3px;"
           "}"
           "QScrollBar::handle:vertical {"
           "    background-color: #d4d4d4;"
           "    border-radius: 3px;"
           "    min-height: 15px;"
           "    max-height: 15px;"
           "}"
           "QScrollBar::add-line:vertical,"
           "QScrollBar::sub-line:vertical {"
           "    height: 0px;"
           "    background: none;"
           "}"
           "QScrollBar:horizontal {"
           "    width: 0px;"
           "    height: 0px;"
           "}";  // QScrollArea的样式
}

/// @brief 获得输入框的样式
static inline const QString get_line_edit_style()
{
    return "QLineEdit {"
           "border-radius: 5px; "
           "background-color: #f5f5f5; "
           "padding-left: 5px;"
           "} QLineEdit:focus {"
           "border: 1px solid #0099FF;"
           "}";
}

/// @brief 获得蓝色按钮的样式
static inline const QString get_blue_button_style()
{
    return "QPushButton {"
           "    font-size: 14px;"
           "    background-color: #0099FF;"
           "}"
           "QPushButton:hover {"
           "    background-color: #0093F5;"
           "}"
           "QPushButton:pressed {"
           "    background-color: #0086E0;"
           "}";
}

/// @brief 白色按钮的样式
static inline const QString get_white_button_style()
{
    return "QPushButton{"
           "background-color: #F2F2F2;"
           "border: 1px solid #757575;"
           "}"
           "QPushButton:hover {"
           "background-color: #E9E9E9;"
           "}"
           "QPushButton:pressed {"
           "background-color: #D5D5D5;"
           "}";
}

/// @brief 获得DateTimeEdit的样式
static inline const QString get_date_time_edit_style()
{
    return
        R"(
    QDateTimeEdit {
        border: 1px solid #d0d0d0;
        border-radius: 2px;
        padding: 5px 8px; 
        background-color: #ffffff;
        font-size: 13px;
        color: #333333;
        selection-background-color: #4b99f5; 
    }
    
    QDateTimeEdit:hover {
        border-color: #a0a0a0;
        background-color: #f9f9f9;
    }
    
    QDateTimeEdit:focus {
        border: 1px solid #4a90e2;
        background-color: #ffffff;
    }
    
    QDateTimeEdit::down-button {
        border:none;
        width:25px;
        background-color:white;
    }
    QDateTimeEdit::up-button {
        border:none;
        width:25px;
        background-color:white;
    }
    /* 向上箭头和向下箭头 */
    QDateTimeEdit::up-arrow {
        image:url(:/image/up.png);
        width: 16px;
        height: 16px;
    }
    QDateTimeEdit::down-arrow {
        image:url(:/image/down.png);
        width: 16px;
        height: 16px;
    }
    QDateTimeEdit::up-button:pressed {
        background-color: #e0e0e0; /* 浅灰色背景 */
        border-radius: 0 4px 0 0; /* 右上角圆角 */
    }

    QDateTimeEdit::down-button:pressed {
        background-color: #e0e0e0; /* 浅灰色背景 */
        border-radius: 0 0 4px 0; /* 右下角圆角 */
    }
)";
}
#endif